package model

import "time"

type Users struct {
	Id           int64     `gorm:"column:id;type:bigint;primaryKey;not null;" json:"id"`
	PhoneNumber  string    `gorm:"column:phone_number;type:varchar(20);not null;" json:"phone_number"`
	PasswordHash string    `gorm:"column:password_hash;type:varchar(100);not null;" json:"password_hash"`
	Nickname     string    `gorm:"column:nickname;type:varchar(50);not null;" json:"nickname"`
	AvatarUrl    string    `gorm:"column:avatar_url;type:varchar(255);default:NULL;" json:"avatar_url"`
	Bio          string    `gorm:"column:bio;type:text;" json:"bio"`
	CreatedAt    time.Time `gorm:"column:created_at;type:timestamp;default:CURRENT_TIMESTAMP;" json:"created_at"`
	UpdatedAt    time.Time `gorm:"column:updated_at;type:timestamp;default:CURRENT_TIMESTAMP;" json:"updated_at"`
}
type Videos struct {
	Id            int64     `gorm:"column:id;type:bigint;primaryKey;not null;" json:"id"`
	UserId        int64     `gorm:"column:user_id;type:bigint;not null;" json:"user_id"`
	Title         string    `gorm:"column:title;type:varchar(100);not null;" json:"title"`
	Description   string    `gorm:"column:description;type:text;" json:"description"`
	FilePath      string    `gorm:"column:file_path;type:varchar(255);not null;" json:"file_path"`
	CoverImageUrl string    `gorm:"column:cover_image_url;type:varchar(255);default:NULL;" json:"cover_image_url"`
	Status        string    `gorm:"column:status;type:enum('pending', 'approved', 'rejected');default:pending;" json:"status"`
	Duration      int32     `gorm:"column:duration;type:int;default:NULL;" json:"duration"`
	ViewCount     int32     `gorm:"column:view_count;type:int;default:0;" json:"view_count"`
	LikeCount     int32     `gorm:"column:like_count;type:int;default:0;" json:"like_count"`
	CommentCount  int32     `gorm:"column:comment_count;type:int;default:0;" json:"comment_count"`
	IsDraft       int8      `gorm:"column:is_draft;type:tinyint(1);default:0;" json:"is_draft"`
	CreatedAt     time.Time `gorm:"column:created_at;type:timestamp;default:CURRENT_TIMESTAMP;" json:"created_at"`
	UpdatedAt     time.Time `gorm:"column:updated_at;type:timestamp;default:CURRENT_TIMESTAMP;" json:"updated_at"`
}
type Interactions struct {
	Id              int64     `gorm:"column:id;type:bigint;primaryKey;not null;" json:"id"`
	UserId          int64     `gorm:"column:user_id;type:bigint;not null;" json:"user_id"`
	VideoId         int64     `gorm:"column:video_id;type:bigint;not null;" json:"video_id"`
	InteractionType string    `gorm:"column:interaction_type;type:enum('like', 'comment', 'share');not null;" json:"interaction_type"`
	CommentText     string    `gorm:"column:comment_text;type:text;" json:"comment_text"`
	CreatedAt       time.Time `gorm:"column:created_at;type:timestamp;default:CURRENT_TIMESTAMP;" json:"created_at"`
}

func (u *Users) TableName() string {
	return "users"
}
func (v *Videos) TableName() string {
	return "videos"
}
func (i *Interactions) TableName() string {
	return "interactions"
}
